﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace VersionComparer.DataModel.FileSystem
{
    public class FolderItemCreator : ComparableItemCreator
    {
        protected override ComparableItem CreateFromValue(ItemId itemId)
        {
            try
            {
                string path = itemId.Name;
                if ( File.Exists ( path ))
                    return null;
                if (Directory.Exists(path) || path.Contains("*"))
                    return new FolderItem(path);
                else
                    return null;
            }
            catch
            {
                return null;
            }
        }

        public override int Order
        {
            get
            {
                return 10;
            }
        }
    }
}